<?php
defined('DT_ADMIN') or exit('Access Denied');
$menus = array (
    array('行业分类', '?file='.$file),
);
global $db;

if($submit) {
	$sql1 = $sql2 = '';
	
	foreach($right as $key=>$value) {
		$sql = '';
		foreach($value as $k=>$v) {
			$sql .= ",$k='$v'";
		}
		$sql = substr($sql, 1);

		$db->query("UPDATE zb_filtercategory SET $sql WHERE fid='$key'");
	}

	dmsg('更新成功', '?file='.$file.'&update=1');
} else {
	$catef = $db->query("SELECT * FROM {$db->pre}filtercategory WHERE f_cat_sm=0 order by displayorder asc");
        $fenleis = array();
	while($cf = $db->fetch_array($catef)){
            $catez = $db->query("SELECT * FROM {$db->pre}filtercategory WHERE f_cat_sm!=0 and f_cat_lg=".$cf['f_cat_lg'] . " order by displayorder asc" );
            while($cz = $db->fetch_array($catez)){
                $cf['fenleiz'][] = $cz;
            }
            if($cf['f_cat_sm']<1){
                    $cf['f_cat_lgs'] = '0';
            }
            $fenleis[] = $cf;
	}
	include tpl('filtercategory');
}
?>